<?php $this->breadcrumbs=array(
	'Coffee Shops'=>Yii::app()->user->checkAccess('admin')?array('admin'):array('listAll'),
	$model->name=>Yii::app()->user->checkAccess('admin')?array('update','id'=>$model->id):array('viewShop','id'=>$model->id),
	'Images',
);?>

<h1>Manage Images for <?php echo $model->name; ?></h1>
<?php echo CHtml::link('Upload',array('UploadImage','id'=>$model->id));?>
<?php
 $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'coffee-shop-image-grid',
	'dataProvider'=>$imageDataProvider,
	'columns'=>array(
		//'id',
		//'coffeeShop',
		//'title',
		//'description',
		'priority',
 		array(
			'name' => 'thumbPath',
 			'header'=>'Image',
			'type'=>'raw',
			'value' => 'CHtml::link(CHtml::image(Yii::app()->baseUrl.$data->thumbPath),Yii::app()->baseUrl.$data->filePath,array("target"=>"_blank"))',
		),
		array(
			'name' => 'uploadedBy',
 			'header'=>'Uploaded By',
			'type'=>'raw',
			'value' => '$data->uploadedByUser->username',
		),
		/*
		'uploadedBy',
		'uploadTime',
		'uploadIp',*/
		array(
			'name' => 'categoryId',
 			'header'=>'Category',
			'type'=>'raw',
			'value' => 'CoffeeShopImage::$categories[$data->categoryId]',
		),
		
		array(
			//'class'=>'CLinkColumn',
			'header'=>'Delete',
 			//'label'=>'Delete',
			'type'=>'raw',
			'value' => '($data->uploadedBy==Yii::app()->user->getId()||Yii::app()->user->checkAccess("admin"))?CHtml::link("Delete",array("deleteImage","id"=>$data->id),array("target"=>"_blank","confirm"=>"Are you sure to delete this item?")):""',
		
		),
	),
));

?>